﻿using System.Drawing;
using System.Collections.Generic;

namespace HurlBat.XEdit2D
{
    public partial class CharacterNode : Node
    {
        List<AnimationNode> inputs = new List<AnimationNode>();

        public CharacterNode()
        {
            InitializeComponent();
        }

        public CharacterNode(DiagramPanel container, string title)
            : base(container, Icons.user, title, Color.FromArgb(209, 237, 210), Color.FromArgb(66, 103, 60), Color.Black)
        {
            InitializeComponent();
            this.Paint += new System.Windows.Forms.PaintEventHandler(CharacterNode_Paint);
        }

        void CharacterNode_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            SolidBrush b = new SolidBrush(this.ForeColor);
            e.Graphics.DrawString(string.Format("{0} input{1}", inputs.Count, inputs.Count == 1 ? "" : "s"),
                new Font("Arial", 10, FontStyle.Regular), b, 3, 30);
        }

        public override bool AddInput(Node input)
        {
            if (input.GetType() != typeof(AnimationNode)) return false;
            inputs.Add((AnimationNode)input);
            this.Invalidate();
            return true;
        }

        public override bool AllowOutput()
        {
            return false;
        }
    }
}
